home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************************
- Snippet: SimpleInit
-
- Description: This snippet demonstrates the writing of a simple init which
- attempts to allocate a 1 megabyte and then a 2 megabyte handle
- in the System heap. Please note the 'sysz' resource in the init
- which is necessary in order to allocate the memory (see Inside
- Macintosh Memory page 2-13; NOTE: the 'sysz' resource *is* in
- fact still required under System 7 contrary to the statement in
- Inside Macintosh Memory)
-
- Programmer: Kevin Mellander
- Organization: Apple Computer, Inc.
- Department Developer Technical Support, DTS
- Language/Envir. MPW C version 3.3.1
- Date Created 12/12/94
-
- *****************************************************************************************/
- #include <Memory.h>
- #include <Types.h>
-
- #pragma segment Main
- main()
- {
- Handle mySysHandle = nil;
-
- mySysHandle = NewHandleSys(1000000);
-
- if (mySysHandle == nil)
- DebugStr("\p the 1,000,000 byte call to mySysHandle failed");
- else
- DebugStr("\p the 1,000,000 byte call to mySysHandle succeeded");
-
- if (mySysHandle)
- DisposeHandle(mySysHandle);
-
- mySysHandle = NewHandleSys(2000000);
-
- if (mySysHandle == nil)
- DebugStr("\p the 2,000,000 byte call to mySysHandle failed");
- else
- DebugStr("\p the 2,000,000 byte call to mySysHandle succeeded");
-
- if (mySysHandle)
- DisposeHandle(mySysHandle);
-
- }